#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include"string.hpp"

using namespace std;

void string_test1()
{
	sbh::string s;
	s.push_back('a');
	s.push_back('b');
	cout << s.c_str() << endl;
	cout << s.size() << " " << s.capacity() << endl;

	s.push_back('c');
	s += 'd';
	s += 'e';
	s += 'f';
	cout << s.c_str() << endl;
	cout << s.size() << " " << s.capacity() << endl;
}

void string_test2()
{
	sbh::string s;
	s.append("abc");
	cout << s.c_str() << endl;
	cout << s.size() << " " << s.capacity() << endl;

	s += "def";
	cout << s.c_str() << endl;
	cout << s.size() << " " << s.capacity() << endl;
}

void string_test3()
{
	sbh::string s1("abcdef");
	sbh::string s2("abcdef");
	sbh::string s3("bcdefa");
	sbh::string s4;

	cout << (s1 == s2) << endl;
	cout << (s2 == s3) << endl;
	cout << (s1 < s3) << endl;
	cout << (s2 >= s3) << endl;
	cout << s1.empty() << endl;
	cout << s4.empty() << endl;
}

void string_test4()
{
	sbh::string s;
	s += "abcdefgh";
	cout << s.c_str() << endl;
	cout << s.size() << " " << s.capacity() << endl;

	s.push_back('i');
	s.push_back('j');
	s.append("klmn");
	cout << s.c_str() << endl;
	cout << s.size() << " " << s.capacity() << endl;

	s.erase(2,3);
	cout << s.c_str() << endl;
	cout << s.size() << " " << s.capacity() << endl;
}

void string_test5()
{
	sbh::string s;
	s += "abcdefh";
	cout << s.c_str() << endl;

	sbh::string::iterator it = s.begin();
	while (it != s.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;

	for (auto ch : s)
	{
		cout << ch;
	}
	cout << endl;
}

void string_test6()
{
	sbh::string s;
	s.append("abc");
	cout << s << endl;
	cout << s.size() << " " << s.capacity() << endl;

	s += "def";
	cout << s << endl;
	cout << s.size() << " " << s.capacity() << endl;

	cin >> s;
	cout << s << endl;
	cout << s.size() << " " << s.capacity() << endl;
}

int main()
{
	string_test6();

	return 0;
}